package com.blog.feign.fallback;

import com.blog.feign.ProductFeignClient;
import com.blog.product.Product;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * @ClassName ProductFeignClientFallBack
 * @Destription 兜底回调，配合熔断
 * @Author 天堂小野花
 * @Date 2025/8/1  23:51
 * @Version 1.0
 */
@Component
public class ProductFeignClientFallBack implements ProductFeignClient {
    @Override
    public Product getProductById(Integer id) {
        System.out.println("兜底回调...........");
        Product product = new Product();
        product.setId(id);
        product.setProductName("未知商品");
        product.setNum(0);
        product.setPrice(new BigDecimal(0));
        return product;
    }
}
